﻿using AbpApplication.InPut;
using AbpEntityFrameworkcore.DbContext;
using AbpToDomain.EntityInfo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;

namespace AbpApplication.Expand
{
   public   class QueryDynamic_WarehouseLine
    {

        private  readonly MyDbContext context;

        public  QueryDynamic_WarehouseLine(MyDbContext context )
        {
            this .context = context;
        }

        public   List<WarehouseLine> QueryDynameic(string? WarehouseLineCode,
            int? Long,int? Wide,int? high,int? Xaxis,int?
                Yaxis, int? Zaxis,bool? IsEnable)
        {
           
              IQueryable<WarehouseLine> warehouseLines = context.warehouseLines;
    
              if (!string.IsNullOrEmpty(WarehouseLineCode))
                {
                    warehouseLines = warehouseLines.Where(b => b.WarehouseLineCode.Contains(WarehouseLineCode));
                }   
                if(Long!=null)
                {
                warehouseLines = warehouseLines.Where(x => x.Long == Long);
                }
                if (Wide != null)
                {
                warehouseLines = warehouseLines.Where(x => x.Wide == Wide);
                }
                if (high != null)
                {
                warehouseLines = warehouseLines.Where(x => x.high == high);
                }
                if (Xaxis != null)
                {
                warehouseLines = warehouseLines.Where(x => x.Xaxis == Xaxis);
                }
                if (Yaxis != null)
                {
                warehouseLines = warehouseLines.Where(x => x.Yaxis == Yaxis);
                }
                if (Zaxis != null)
                {
                warehouseLines = warehouseLines.Where(x => x.Zaxis == Zaxis);
                }
                if (IsEnable != null)
                {
                warehouseLines = warehouseLines.Where(x=>x.IsEnable == IsEnable);
                }
                return warehouseLines.ToList();
        }
    }
}
